package net.chathu.airgw.packets.gw.clientpackets 
{
	import net.chathu.airgw.model.PrivateChatInfo;
	import net.chathu.airgw.model.User;
	import net.chathu.airgw.util.ByteArrayUtil;
	/**
	 * ...
	 * @author ze
	 */
	public class CMDGWClosePriv extends IRCReceivablePacket 
	{
		
		public function CMDGWClosePriv() 
		{
			
		}
		
		
		override public function execute():void {
			var userName:String = data[1];
			var partner:User = User(sessionData.chatData.users.getUserByNameIgnoreCase(userName));
			if (partner) {
				var partnerId:int = partner.id;
				var privInfo:PrivateChatInfo = sessionData.chatData.getPrivateChatInfoByPartnerId(partnerId);
				if (privInfo)
				{
					//ha epp beszeltek
					sendToChat(ByteArrayUtil.convertParams(["unsub","private/" + privInfo.privateId]));
				}
			}
		}
		
		public static function getShortUsageDescription():String {
			return "Privát beszélgetés bezárás";
		}
		
		public static function getUsageDescription():String {
			return "Példa:\n" +
				"/gwclosepriv gipsz_jakab\n\n" +
				"Eredmény:\n" + 
				"-gipsz_jakab- A beszélgetés befejeződött!";
		}
	}

}